﻿using Microsoft.SharePoint.Administration;

namespace Com.FastSearch.SharePoint.Interfaces
{
    /// <summary>
    /// Interface for factories that produce <see cref="IESPSearchManager"/>s.
    /// </summary>
    public interface IESPSearchManagerFactory
    {
        /// <summary>
        /// Create a search manager for the given SharePoint Web Application. Uses the global QRServer
        /// configuration set in "Site Settings -> Site Collection Administration -> ESP Query Server
        /// Connections". If another search engine than the one configured globally should be used, the
        /// <see cref="Create(string)"/> method applies.
        /// </summary>
        /// <param name="app">the web application</param>
        /// <returns>a search manager for the web application</returns>
        IESPSearchManager Create(SPWebApplication app);

        /// <summary>
        /// Create a search manager using the specified qrserver connection, which is a comma-separated
        /// list of host:port pairs for the qrservers in the FAST search engine to use. This method
        /// should be used if another search engine than the one configured on the web application level
        /// should be used.
        /// </summary>
        /// <param name="connection">qrservers to search against</param>
        /// <returns>a search manager for the given qrservers</returns>
        IESPSearchManager Create(string connection);
    }
}
